package com.crazyauntzhang.easyshopbackend.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用于统一响应体格式
 * 响应体对象通过该类的构造方法产生
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {

	private Integer code;
	private String msg;

	private T data;

	public ResponseResult(Integer code) {
		this.code = code;
	}

	public ResponseResult(String msg) {
		this.msg = msg;
	}

	public ResponseResult(T data) {
		this.data = data;
	}

	public ResponseResult(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public ResponseResult(Integer code, T data) {
		this.code = code;
		this.data = data;
	}

	public ResponseResult(String msg, T data) {
		this.msg = msg;
		this.data = data;
	}


}
